<template>
  <div class="height-100">
    <h3>Welcome</h3>
    <textarea name="复制内容" id cols="30" rows="10" v-model="value"></textarea>
    <textarea name="粘贴内容" id cols="30" rows="10"></textarea>
    <button @click="seccendCopy">第二种方式复制</button>
  </div>
</template>

<script>
import Vue from 'vue'
import VueClipBoard from 'vue-clipboard2'
Vue.use(VueClipBoard)
export default {
  data() {
    return {
      value: 'A simple vuejs 2 binding for clipboard.js!'
    }
  },
  methods: {
    seccendCopy() {
      this.$copyText(this.value).then(
        function (e) {
          console.log('copy arguments e:', e)
          alert('复制成功!')
        },
        function (e) {
          console.log('copy arguments e:', e)
          alert('复制失败!')
        }
      )
    }
  }
}
</script>

<style lang="less" scoped>
</style>
